<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf"><{$tit}>列表</div>
                </div>
                <div class="am-tabs am-margin-bottom">
                    <{tabTit1($tabtit)}>
                </div>
                <div class="widget-body am-fr">
                    <!-- 工具栏 -->
                    <div class="page_toolbar am-margin-bottom-xs am-cf">
                        <{include file='admin/public/export.php'}>
                        <{include file='admin/public/search_time.php'}>
                    </div>
                    <div class="order-list am-scrollable-horizontal am-u-sm-12 am-margin-top-xs">
                        <table width="100%" class="am-table am-table-centered
                        am-text-nowrap am-margin-bottom-xs">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>图片</th>
                                <th>科室</th>
                                <th>位置</th>
                                <th>标题</th>
                                <th>分类</th>
                                <th>设备</th>
                                <th>人员</th>
                                <th>状态</th>
                                <th>时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $colspan = 10; ?>
                            <?php if ($list): foreach ($list as $val): ?>
                                <tr class="order-empty">
                                    <td colspan="<?= $colspan ?>"></td>
                                </tr>
                                <!-- <tr>
                                    <td class="am-text-middle am-text-left" colspan="<?= $colspan ?>">
                                        <span class="am-margin-right-lg">订单号：<?= $val['id'] ?></span>
                                        <span class="am-margin-right-lg">时间：<?= $val['add_time'] ?></span>
                                    </td>
                                </tr> -->
                                <tr>
                                    <td class="am-text-middle"><?= $val['id'] ?></td>
                                    <td class="am-text-middle">
                                        <a href="<?= $val['img'] ?>" title="点击查看大图" target="_blank">
                                            <img src="<?= $val['img'] ?>" width="72" height="72" alt="">
                                        </a>
                                    </td>
                                    <td class="am-text-middle"><?= $zones[$val['zone_id']]['name'] ?></td>
                                    <td class="am-text-middle"><?= $val['local'] ?></td>
                                    <td class="am-text-middle"><?= $val['title'] ?></td>
                                    <td class="am-text-middle"><?= $areas[$val['area_id']]['name'] ?>-<?= $cates[$val['cate_id']]['name'] ?></td>
                                    <td class="am-text-middle"><?= $devices[$val['device_id']]['name'] ?></td>
                                    <td class="am-text-middle">
                                        <?= $admins[$val['admin_id']]['realname'] ?><br >
                                        <a href="/<{$routeUrl}>/index?shifu_id=<?= $val['shifu_id'] ?>">
                                            <?= $shifus[$val['shifu_id']]['realname'] ?> - <?= $shifus[$val['shifu_id']]['tel'] ?>
                                        </a>
                                    </td>



                                    <td class="am-text-middle">
                                        <span class="am-badge <?= $val['order_status'] == 5 ? 'am-badge-success' : '' ?>">
                                            <?= $orderStatus[$val['order_status']] ?>
                                        </span>
                                    </td>
                                    <td class="am-text-middle">
                                        <?= $val['add_time'] ?><br >
                                        <?= $val['up_time'] ?>
                                    </td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <!-- <a href="/<{$routeUrl}>/edit?id=<?= $val['id'] ?>">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a> -->
                                            <a href="javascript:;" class="item-delete tpl-table-black-operation-del"
                                                data-id="<?= $val['id'] ?>">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                <?php $i = 0;
                                foreach ($order['goods'] as $goods): $i++; ?>
                                    <tr>
                                        <td class="goods-detail am-text-middle">
                                            <div class="goods-image">
                                                <img src="<?= $order['photo'] ?>" alt="">
                                            </div>
                                            <div class="goods-info">
                                                <p class="goods-title"><?= $goods['goods_name'] ?></p>
                                                <p class="goods-spec am-link-muted"><?= $goods['goods_attr'] ?></p>
                                            </div>
                                        </td>
                                        <td class="am-text-middle">
                                            <p>￥<?= $goods['goods_price'] ?></p>
                                            <p>×<?= $goods['total_num'] ?></p>
                                        </td>
                                        <?php if ($i === 1) : $goodsCount = count($order['goods']); ?>
                                            <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                <p>￥<?= $order['pay_price'] ?></p>
                                                <p class="am-link-muted">(含运费：￥<?= $order['express_price'] ?>)</p>
                                            </td>
                                            <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                <p><?= $order['user']['nickName'] ?></p>
                                                <p class="am-link-muted">(用户id：<?= $order['user']['user_id'] ?>)</p>
                                            </td>
                                            <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                <span class="am-badge am-badge-secondary">
                                                    <?= $order['pay_type']['text'] ?>
                                                </span>
                                            </td>
                                            <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                <span class="am-badge am-badge-secondary">
                                                    <?= $order['delivery_type']['text'] ?>
                                                </span>
                                            </td>
                                            <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                <p>付款状态：
                                                    <span class="am-badge
                                                <?= $order['pay_status']['value'] == 20 ? 'am-badge-success' : '' ?>">
                                                        <?= $order['pay_status']['text'] ?></span>
                                                </p>
                                                <p>发货状态：
                                                    <span class="am-badge
                                                <?= $order['delivery_status']['value'] == 20 ? 'am-badge-success' : '' ?>">
                                                        <?= $order['delivery_status']['text'] ?></span>
                                                </p>
                                                <p>收货状态：
                                                    <span class="am-badge
                                                <?= $order['receipt_status']['value'] == 20 ? 'am-badge-success' : '' ?>">
                                                        <?= $order['receipt_status']['text'] ?></span>
                                                </p>
                                                <?php if ($order['order_status']['value'] == 20 || $order['order_status']['value'] == 21): ?>
                                                    <p>订单状态：
                                                        <span class="am-badge am-badge-warning"><?= $order['order_status']['text'] ?></span>
                                                    </p>
                                                <?php endif; ?>
                                            </td>
                                            <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
                                                <div class="tpl-table-black-operation">
                                                    <?php if (checkPrivilege('order/detail')): ?>
                                                        <a class="tpl-table-black-operation-green"
                                                           href="<?= url('order/detail', ['order_id' => $order['order_id']]) ?>">
                                                            订单详情</a>
                                                    <?php endif; ?>
                                                    <?php if (checkPrivilege(['order/detail', 'order/delivery'])): ?>
                                                        <?php if ($order['pay_status']['value'] == 20
                                                            && $order['delivery_status']['value'] == 10
                                                            && $order['order_status']['value'] != 20
                                                            && $order['order_status']['value'] != 21
                                                        ): ?>
                                                            <a class="tpl-table-black-operation"
                                                               href="<?= url('order/detail#delivery',
                                                                   ['order_id' => $order['order_id']]) ?>">去发货</a>
                                                        <?php endif; ?>
                                                    <?php endif; ?>
                                                    <?php if (checkPrivilege(['order/detail', 'order.operate/confirmcancel'])): ?>
                                                        <?php if ($order['order_status']['value'] == 21): ?>
                                                            <a class="tpl-table-black-operation-del"
                                                               href="<?= url('order/detail#cancel',
                                                                   ['order_id' => $order['order_id']]) ?>">去审核</a>
                                                        <?php endif; ?>
                                                    <?php endif; ?>
                                                </div>
                                            </td>
                                        <?php endif; ?>
                                    </tr>
                                <?php endforeach; ?>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="<?= $colspan ?>" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"><{$showPage nofilter}> </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：<{$total}></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script>
    $(function () {

        // 审核
        $('.j-act').opid('id', "/<{$routeUrl}>/act");
        // 隐藏
        $('.j-ban').opid('id', "/<{$routeUrl}>/ban");
        // 删除
        $('.j-del').opid('id', "/<{$routeUrl}>/del");

        // 上下班
        $('.item-sign').act('id', "/<{$routeUrl}>/sign");
        // 值班
        $('.item-zhiban').act('id', "/<{$routeUrl}>/zhiban");
        // 状态
        $('.item-act').act('id', "/<{$routeUrl}>/act");
        // 删除元素
        $('.item-delete').delete('id', "/<{$routeUrl}>/del", '删除后不可恢复，确定要删除吗？');

    });
</script>